'''
隐式等待
显式等待
sleep死等
'''
from kyb_caps import driver, By, webdriver, sleep
# 1、隐式等待：参见 kyb_caps
# 2、显示等待：
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

# # 写法1
# register_btn_loc = (By.ID, 'com.tal.kaoyan:id/login_register_text')
# # WebDriverWait(driver, 30, 0.5).until(EC.presence_of_element_located(register_btn_loc))
# ele = WebDriverWait(driver, 30, 0.5).until(EC.visibility_of_element_located(register_btn_loc))
# ele.click()
# sleep(3)

# 写法2：
register_btn_loc = (By.ID, 'com.tal.kaoyan:id/login_register_text')
ele = WebDriverWait(driver, 30, 0.5).until(lambda x: x.find_element(*register_btn_loc))
ele.click()
# 3、sleep 死等
sleep(3)

driver.quit()
